<html>
<head>
<title>Printable Page View</title>
<link rel="stylesheet" type="text/css" href="@{'/public/stylesheets/PrintablePayslipView/showPrintablePage.css'}">
</head>
<body>
#{list payslips, as:'payslip'}
<table>
  <tr>
    <td width="310px">DBD** ${clientName}</td>
    <td colspan="4">HOURLY RATE</td>
  </tr>
  <tr>
    <td>PERIOD: ${payrollPeriod}</td>
    <td colspan="4">${payslip.rate}</td>
  </tr>
  <tr>
    <td colspan="5">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5">${payslip.employeeName}</td>
  </tr>
  <tr>
    <td valign="top">
      <table>
        <tr>
          <td width="190px">&nbsp;</td>
          <td align="right">Hrs</td>
          <td width="80px" align="right">Total Income</td>
        </tr>
        <span style="display:none;">${paymentCounter = 0}</span>
        #{list payslip.payments, as:'payslipPayment'}
        <tr>
          #{if payslipPayment.payment != null}
          <td>${payslipPayment.paymentType}</td>
          <td align="right">${payslipPayment.hours != null ? payslipPayment.hours.format('0.00') : ''}</td>
          <td align="right">${payslipPayment.payment.format('#,###,###.00')}</td>
          <span style="display:none;">${paymentCounter++}</span>
          #{/if}
        </tr>
        #{/list}

        <span style="display:none;">${paymentCounter = 16 - paymentCounter}</span>
        #{list items:1..paymentCounter}
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
        #{/list}

        <tr>
          <td colspan="2">GROSS PAY</td>
          <td align="right">${payslip.grossPay.format('#,###,###.00')}</td>
        </tr>
        <tr>
          <td colspan="2">TAKE HOME PAY</td>
          <td align="right" class="netPay">${payslip.takeHomePay.format('Php #,###,###.00')}</td>
        </tr>
      </table>
    </td>
    <td valign="top">
      <table>
        <tr>
          <td width="235px" align="right" colspan="2">Total Deduction</td>
        </tr>
        <span style="display:none;">${deductionCounter = 0}</span>
        #{list payslip.deductions, as:'payslipDeduction'}
        <tr>
          #{if payslipDeduction.deduction != null}
          <td>${payslipDeduction.deductionType}</td>
          <td align="right">${payslipDeduction.deduction.format('#,###,###.00')}</td>
          <span style="display:none;">${deductionCounter++}</span>
          #{/if}
        </tr>
        #{/list}

        <span style="display:none;">${deductionCounter = 16 - deductionCounter}</span>
        #{list items:1..deductionCounter}
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
        #{/list}

        <tr>
          <td>TOTAL DEDS</td>
          <td align="right">${payslip.totalDeductions.format('#,###,###.00')}</td>
        </tr>
      </table>
    </td>
    <td class="verticalLine">&nbsp;</td>
    <td width="15px"></td>
    <td valign="top">
      <table>
        <tr align="center">
          <td align="center">DBD** ${clientName}</td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
          <td align="center">RECEIVED PAYROLL PERIOD</td>
        </tr>
        <tr>
          <td>${payrollPeriod}</td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr class="netPay">
          <td align="center">${payslip.takeHomePay.format('Php #,###,###.00')}</td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
          <td class="signatureLine">${payslip.employeeName}</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
#{if (payslip_index % 3) != 0 && !payslip_isLast}
<hr style="border-style: dashed;" />
#{/if}
#{else}
<br />
#{/else}
#{/list}
</body>
</html>
